class Solution(object):
    def maximumGroups(self, grades):
        grades.sort()
        print(grades)
        m = len(grades)
        if m < 3:
            return 1
        l = 1
        r = m
        while l < r:
            mid = (l + r + 1) / 2
            if mid * (1 + mid) <= 2 * m:
                l = mid
            else:
                r = mid - 1
        return l
